<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<link id='theme' rel='stylesheet' href='static/css/modifycustom.css'/>
<div class="customer_container">
<form id="cform" action="customer/update" method="post">
	<!-- 保存客户id -->
	<input type="hidden" id="id" name="id" value="${customer.id}"/>
	<div class="subtitle">基本信息</div>
	<div class="info1">
		<ul>
			<li>企业名称：
			<input type="text" id="custom_name" name="customname" value="${customer.customname }" class="easyui-validatebox" required="required" /> <span style="color:red;">*</span></li>
			<li>企业类型：<input id="customtypename" type="hidden" name="customtypename" value="${customer.customtypename }"/>
			    <select id="selectcustomtype" name="customtype" class="easyui-validatebox" required="required">
        	 		<option value="" selected="selected">--请选择--</option>
        	 			<c:if test="${customTypeList != null }">
        	 				<c:forEach items="${ customTypeList}" var="customtype">
        	 				<option
        	 					<c:if test="${customer.customtype == customtype.configtypevalue }">
        	 						selected = "selected"
        	 					</c:if>
        	 					value="${ customtype.configtypevalue}">
        	 					${customtype.configtypename }
        	 				</option>
        	 				</c:forEach>
        	 			</c:if>
	      		</select> <span style="color:red;">*</span></li>
			<li>企业主页：<input type="text" name="siteurl" value="${ customer.siteurl}" /></li>
			<li>状态：<select name="customstatus" >
					 <c:choose>
					 	<c:when test="${customer.customstatus == 1 }">
					 		<option value="1" selected="selected">启用</option>
	        	 	  		<option value="0">停用</option>
					 	</c:when>
					 	<c:otherwise>
					 		<option value="0" selected="selected">停用</option>
	        	 	  		<option value="1">启用</option>
					 	</c:otherwise>
					 </c:choose>
	      		 </select> <span style="color:red;">*</span></li>
		</ul>
		<div class="clear"></div>
	</div>
	<div class="subtitle">门户信息</div>
	<div class="info2">
		<ul>
			<li>法人代表：<input type="text" name="bossname" value="${customer.bossname }" /></li>
			<li>注册日期：<input id="regdate" size="15" name="regdatetime" value="<fmt:formatDate value="${customer.regdatetime}" pattern="yyyy-MM-dd"/>" class="easyui-datebox"  type="text"/></li>
			<li>证件类型：<input id="cardtypename" type="hidden" name="cardtypename" value="${ customer.cardtypename}"/>
			     <select id="selectcardtype" name="cardtype" >
        	 		<option value="" selected="selected">--请选择--</option>
        	 			<c:if test="${ cardTypeList != null}">
        	 				<c:forEach items="${cardTypeList }" var="cardtype">
        	 					<option 
        	 						<c:if test="${customer.cardtype == cardtype.configtypevalue}">
        	 							selected = "selected"
        	 						</c:if>
        	 						value="${ cardtype.configtypevalue}"
        	 					>
        	 					${ cardtype.configtypename}
        	 					</option>
        	 				</c:forEach>
        	 			</c:if>
	      		</select></li>
			<li>证件号码：<input type="text" name="cardnum" value="${ customer.cardnum}" /></li>
			<li>国家：<input type="text" name="country" value="${ customer.country}" /></li>
			<li>省/地区：<select id="selectprovince" name="province" >
					<c:if test="${empty customer.province}">
						<option value="" selected="selected">--请选择--</option>
					</c:if>
					<c:if test="${provinceList != null }">
						<c:forEach items="${provinceList }" var="pro">
							<c:choose>
								<c:when test="${customer.province == pro.provinceid }">
									<option value="${ pro.provinceid}" selected="selected">${pro.province }</option>
								</c:when>
								<c:otherwise>
									<option value="${ pro.provinceid}">${pro.province }</option>
								</c:otherwise>
							</c:choose>
						</c:forEach>
					</c:if>
	      		 </select>
			</li>
			<li>公司传真：<input type="text" name="companyfax" value="${ customer.companyfax}"/></li>
			<li>城市：
			<select id="selectcity" name="city" >
					<c:if test="${empty customer.city}">
						<option value="" selected="selected">--请选择--</option>
					</c:if>
					<c:if test="${cityList != null }">
						<c:forEach items="${cityList }" var="c">
							<c:choose>
								<c:when test="${customer.city == c.cityid }">
									<option value="${ c.cityid}" selected="selected">${c.city }</option>
								</c:when>
								<c:otherwise>
									<option value="${ c.cityid}">${c.city }</option>
								</c:otherwise>
							</c:choose>
						</c:forEach>
					</c:if>
	      		 </select>
			</li>
			<li>公司电话：<input type="text" name="companytel" value="${customer.companytel }"/></li>
			<li>区：
			<select id="selectarea" name="area" >
					<c:if test="${empty customer.area}">
						<option value="" selected="selected">--请选择--</option>
					</c:if>
					<c:if test="${areaList != null }">
						<c:forEach items="${areaList }" var="a">
							<c:choose>
								<c:when test="${customer.area == a.areaid }">
									<option value="${ a.areaid}" selected="selected">${a.area }</option>
								</c:when>
								<c:otherwise>
									<option value="${ a.areaid}">${a.area }</option>
								</c:otherwise>
							</c:choose>
						</c:forEach>
					</c:if>
	      		 </select>
			<li>公司地址：<input type="text" name="companyaddress" value="${customer.companyaddress }" /></li>
		</ul>
		<div class="clear"></div>
		<div>
		备注：<textarea rows="2" cols="50" name="memo">${customer.memo}</textarea>
		</div>
	</div>
	<div class="subtitle"> 
		<a href="javascript:void(0);" id="addcontact">添加一个联系人</a>
			<c:choose>
				<c:when test="${empty customer.contactList }">
					<input type="hidden" id="c_count" value="0"/>
				</c:when>
				<c:otherwise>
					<input type="hidden" id="c_count" value="${customer.contactList.size()}"/>
				</c:otherwise>
			</c:choose>
     </div>
	<div class="info3">
		<table>
            <thead>
            <tr>
	     	<th>姓名</th>
	     	<th>电话</th>
	     	<th>传真</th>
	     	<th>邮箱</th>
	     	<th>职务</th>
	     	<th>操作</th>
  			</tr>                                                                          
            </thead>
            <tbody id="addtr">
            	<c:if test="${ customer.contactList != null}">
            		<c:forEach items="${customer.contactList }" var="contact" varStatus="sta">
            		<tr>
            		<td><input type="text" name="contactList[${sta.index}].contactname" value="${contact.contactname }" class='easyui-validatebox' required='required' /><span style="color:red;">*</span></td>
					<td><input type="text" name="contactList[${sta.index}].contacttel" value="${contact.contacttel }" class='easyui-validatebox' required='required' /><span style="color:red;">*</span></td>
					<td><input type="text" name="contactList[${sta.index}].contactfax" value="${contact.contactfax }"/></td>
					<td><input type="text" name="contactList[${sta.index}].contactemail" value="${contact.contactemail }"/></td>
					<td><input type="text" name="contactList[${sta.index}].contactrole" value="${contact.contactrole }"/></td>
					<td><a href='javascript:void(0);' onclick="getDel(this)">删除</a></td>
					</tr>
            		</c:forEach>
            	</c:if>
            </tbody>
          </table>    
	</div>
</form>
</div>
<script type="text/javascript" src="static/js/updatecustomer.js" charset="UTF-8"></script> 